
<?php

$img = glob('public/upload/ambientes/'.$this->ambiente['AMB_ID'].'.*');
@$img = $img[0];

?>

<div id="ctn_ambiente" style="background-image: url('<?php echo $this->urlbase.'/'.$img; ?>'); ?>">
    
    <div class="c_a_til"><?php echo $this->ambiente['AMB_NOM']; ?></div>
    
    <div class="c_a_amb">
        <div class="slider-prj">
            <?php

            $query = 'SELECT SQL_CACHE * FROM AMBIENTES WHERE AMB_STA = 1 ORDER BY AMB_ORD ASC';
            $result = $this->db->fetchAll($query);
            ?>
            <ul>
                <?php foreach($result as $row) { 
                    $img = glob('public/upload/ambientes/'.$row['AMB_ID'].'_crs.*');

                    if(isset($img[0])) { 
                ?>
                <li id="<?php echo $row['AMB_ID']; ?>">
                    <a href="<?php echo $this->urlbase.'/ambientes/detalhe/id/'.$row['AMB_ID']; ?>">
                        <img src="<?php echo $this->urlbase.'/'.$img[0];?>"  />
                        <div class="img-dsc">
                            <div class="i_d_txt"><?php echo $row['AMB_NOM']; ?></div>
                        </div>
                    </a>
                </li>
                <?php } }  ?>
            </ul>
        </div>
        <?php // auto: 4, scroll: 1, wrap: 'circular'  ?>
        <script src="<?php echo $this->urlbase;?>/public/media/js/jquery.jcarousel.min.js" type="text/javascript"></script>
        <script>
        $(document).ready(function() {  
            $('.slider-prj').jcarousel({ scroll: 1  }); 
        });
        </script>  
    </div>
    
</div>
